package littlecyberwar.util;

import java.util.*;
import javax.swing.JLabel;
import javax.swing.text.Document;
import littlecyberwar.model.*;

/**
 * A general utility class to handle misc func
 */
public class Util {
  public static HashMap lookup = new HashMap();
  public static HashMap	profilePanelLookup = new HashMap(2);
  private static JLabel statusBar;
  private static String mapDistanceUnit;
  private static double mapScale;
  private static Document scenarioNotes;
  private static String scenarioName;

  /**
   * all the lookup table key definition
   */
  public final static String _EL_SELECTED_FROM_TRAY="ts".intern();
  public final static String _CURR_MOUSE_HANDLER="mh".intern();
  public final static String _CURR_SELECTED_TRAY="ct".intern();
  public final static String _PLAYING_BOARD_MODEL="mod".intern();
  public final static String _MAIN_FRAME="main".intern();
  
  public final static String _MODEL_FACADE="mf".intern();
  public static final String _forwardKey="FOR".intern();
  public static final String _rightKey="RIGHT".intern();
  public static final String _leftKey="LEFT".intern();
  public static final String _sideKey="SIDE".intern();
  public static final String _backKey="BACK".intern();
  public static final String _freeKey="FREE".intern();
  public static final String _deployKey="DEP".intern();
  public static final String _obliqueKey="OBL".intern();
  public static final String _rotateKey="ROT".intern();
  public static final String _diceKey="DIE".intern();
  public static final String _tapeKey="TAP".intern();
  public static final String _chatKey="CHAT".intern();
  public static final String _recordKey="REC".intern();
  public static final String _playKey="PLAY".intern();
  public static final String _loadKey="LOAD".intern();
  public static final String _stopKey="STOP".intern();
  public static final String _watchKey="WATCH".intern();
  public static final String _alignFacingKey="FACE".intern();
  public static final String _alignVerticalKey="VERT".intern();
  public static final String _alignHorizontalKey="HORI".intern();
  public static final String _removeKey="REMOVE".intern();
  public static final String _changeLayerKey="LAYER".intern();
  public static final String _resetMoveKey="RSTMV".intern();

  /**
   * The key for element hash lookup for stuff inside the element
   */
  public static final String _overlayModel="ovm".intern();
  public static final String _overlayInstance="ovi".intern();
  public static final String _space="_".intern();
  public static final String _layer="layer".intern();
  
	public static final String _elementAttribDistanceMoved="Distance Moved".intern();
  public Util() {
  }

  public static void setStatusBar ( JLabel bar ) {
    statusBar = bar;
  }

  public static JLabel getStatusBar() {
    return ( statusBar );
  }

  public static void setMapScale ( double s ) {
    mapScale = s;
  }

  
  public static void setMapDistanceUnit( String u ) {
    mapDistanceUnit = u;
    // now set it in the modelCHangeFacade
    ModelChangeFacade mod = ModelChangeFacade.getInstance();
    mod.setDistanceUnit(u);
  }

  public static double getMapScale () {
    return (mapScale);
  }

  public static String getMapDistanceUnit( ) {
    return (mapDistanceUnit);
  }

/**
 * @return Returns the scenarioNotes.
 */
public static Document getScenarioNotes() {
	return scenarioNotes;
}
/**
 * @param scenarioNotes The scenarioNotes to set.
 */
public static void setScenarioNotes(Document scenarioNotes) {
	Util.scenarioNotes = scenarioNotes;
}
/**
 * @return Returns the scenarioName.
 */
public static String getScenarioName() {
	return scenarioName;
}
/**
 * @param scenarioName The scenarioName to set.
 */
public static void setScenarioName(String scenarioName) {
	Util.scenarioName = scenarioName;
}

public static String getElementHashLookupOverlayInstance( String overlayId ){
	String key = _overlayInstance + _space + overlayId;
	return ( key );
}

/**
 * 
 * @param buttonStr the string associated with a specific button type of overlay
 * @return
 */
public static String getOverlayModelLookupKey( String buttonStr ){
	String key = _overlayModel + _space + buttonStr;
	return ( key );
}
}